public class Dog{
    string name;
    int age;
    ﬂoat weight;
    public void eat(){
        System.out.println(name + "正在吃饭");
    }
    public void sleep(){
        System.out.println(name + "正在睡觉");
    }
    void Bark(){

        System.out.println(name + "汪汪汪~~~");
    }
}


// Cat.Java

public class Cat{
    string name;
    int age;
    ﬂoat weight;

    public void eat(){
        System.out.println(name + "正在吃饭");
    }
    public void sleep()
    {
        System.out.println(name + "正在睡觉");
    }



    void mew(){
        System.out.println(name + "喵喵喵~~~");
    }
}
public class Animal{
                String name;
               int age;
public void eat(){
System.out.println(name + "正在吃饭");
 }

public void sleep(){
 System.out.println(name + "正在睡觉");
}
}


// Dog.java

public class Dog extends Animal{
       void bark(){
 System.out.println(name + "汪汪汪~~~");
 }
}
public class Cat extends Animal{


    void mew(){

        System.out.println(name + "喵喵喵~~~");

 }
}


// TestExtend.java

public class test1 {

    public static void main(String[] args) {

        Dog dog = new Dog();

        // dog类中并没有定义任何成员变量，name和age属性肯定是从父类Animal中继承下来的


        System.out.println(dog.name);

        System.out.println(dog.age);


        // dog访问的eat()和sleep()方法也是从Animal中继承下来的


        dog.eat();

        dog.sleep();

        dog.bark();

 }
}

